from selenium.webdriver.common.by import By
from common.base import Base
from common.functions import open_browser


class UserPage(Base):
    user_url = 'http://139.129.26.163/user.php'

    def a_login(self):
        # 进入用户中心登录页面并登录
        self.get(self.user_url)
        self.max_window()
        self.input_username("lxx")
        self.input_password("123456")
        self.login()

    def input_username(self, username):
        self.find_element((By.NAME, "username")).send_keys(username)

    def input_password(self, password):
        self.find_element((By.NAME, "password")).send_keys(password)

    def login(self):
        self.click((By.CLASS_NAME, "us_Submit"))


if __name__ == '__main__':
    page = UserPage(open_browser())
    page.a_login()
